import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Restart_button here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Restart_button  extends Menu
{
    // Das Bild vom Restartknopf
    private GreenfootImage restart_buttonPic = new GreenfootImage ("restart_button.png");
    
    public Restart_button()
    {
        setImage(restart_buttonPic);
    }
    
    public void act() 
    {
        restart();
    }
    
    /**
     * Startet das derzeitige Level neu
     */
    public void restart()
    {
        if(Greenfoot.mouseClicked(this))
        {
            if (NinjaWorld.level == 1)
            {
                NinjaWorld world = (NinjaWorld) getWorld();
                world.createFirstLevel();
            }
            else if(NinjaWorld.level == 2)
            {
                NinjaWorld world = (NinjaWorld) getWorld();
                world.createSecondLevel();
            }
            else if(NinjaWorld.level == 3)
            {
                NinjaWorld world = (NinjaWorld) getWorld();
                world.createThirdLevel();
            }
            Objects.active = true;
        }
    }
}
